const enumeration = require('../constant/enumeration');
let commonDao = require('../dao/commonDao');

class logServices {


    static getLogByType(gameType = 0) {

        let name = enumeration.gameLogType[gameType] || 'logic';
        return require('pomelo-logger').getLogger(name);

    }

    static async getLogByRuleID(ruleID) {
        let curGameRule = await commonDao.findOneData('unionModel', { 'roomRuleList._id': ruleID });
        let curRule = curGameRule && curGameRule.roomRuleList && curGameRule.roomRuleList.find(item => item._id == ruleID);
        let gameType = curRule && curRule.gameType;
        return this.getLogByType(gameType);
    }



}
module.exports = logServices;